package com.qingcheng.controller.comment;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.entity.PageResult;
import com.qingcheng.entity.Result;
import com.qingcheng.pojo.comment.Report;
import com.qingcheng.service.comment.ReportService;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/report")
public class ReportController {

    @Reference
    private ReportService reportService;

    @GetMapping("/findAll")
    public List<Report> findAll(){
        return reportService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<Report> findPage(int page, int size){
        return reportService.findPage(page, size);
    }

    @PostMapping("/findList")
    public List<Report> findList(@RequestBody Map<String,Object> searchMap){
        return reportService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<Report> findPage(@RequestBody Map<String,Object> searchMap,int page, int size){
        return  reportService.findPage(searchMap,page,size);
    }

    @GetMapping("/findById")
    public Report findById(String id){
        return reportService.findById(id);
    }


    @PostMapping("/add")
    public Result add(@RequestBody Report report){
        reportService.add(report);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody Report report){
        reportService.update(report);
        return new Result();
    }

    @GetMapping("/delete")
    public Result delete(String id){
        reportService.delete(id);
        return new Result();
    }

}
